package com.example.yk_fx.db;

import android.app.Application;

import androidx.room.Room;

public class DataBaseUtil {
    private DataBaseUtil(){}
    private static DataBaseUtil dataBaseUtil = new DataBaseUtil();
    public static DataBaseUtil getInstance(){
        return dataBaseUtil;
    }
    private AppDataBase appDataBase;
    private AccountDao accountDao;
    public void init(Application application){
        appDataBase = Room.databaseBuilder(application,AppDataBase.class,"2204.db").allowMainThreadQueries().build();
        accountDao = appDataBase.getAccountDao();
    }
    public AccountDao getAccountDao(){
        if(accountDao==null){
            accountDao = appDataBase.getAccountDao();
        }
        return accountDao;
    }
}
